//
//  DZAdviceTableViewCell.m
//  DaZhePrivateHomeCuisineClient
//
//  Created by zouzhisheng on 15/2/5.
//  Copyright (c) 2015年 zouzhisheng. All rights reserved.
//

#import "DZAdviceTableViewCell.h"
#import "DZBaseViewController.h"
@implementation DZAdviceTableViewCell

- (void)awakeFromNib {
    // Initialization code
    self.adviceImageView.contentMode=UIViewContentModeScaleAspectFit;
    self.adviceImageView.clipsToBounds=YES;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)loadImageUrlStr:(NSString *)urlStr{
  //  [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeImageSize:) name:@"finshDown" object:nil];
    [self.adviceImageView sd_setImageWithURL: [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",API_DOMAIN,urlStr]]];
//    CGSize size=[Common downloadImageSizeWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",API_DOMAIN,urlStr]]];
////    float imageH=size.height*SCREEN_WIDTH/size.width;
  
    
}
-(void)changeImageSize:(UIImage*)image{
    self.adviceImageView.height=image.size.height;
    DZBaseViewController *baseVC=(DZBaseViewController*)[self viewController];
    [baseVC reloadCellHeigh:image.size.height];
    
}
- (UIViewController*)viewController {
    for (UIView* next = [self superview]; next; next =
         next.superview) {
        UIResponder* nextResponder = [next nextResponder];
        if ([nextResponder isKindOfClass:[UIViewController
                                          class]]) {
            return (UIViewController*)nextResponder;
        }
    }
    return nil;
}
@end
